import http from './index'

export interface Datum {
  id: number
  stock_id: string
  strateName: string
  strateOperate: number
  strateDesc: string
  created: string
  updated: string
  strateLossCount: number
  strateWinCount: number
  strateBackTestRate: number
}

// 股票详情数据类型
export interface StockDetail {
  rate: number // 获利比例
  average: number // 平均成本
  '90_low': number // 90成本-低
  '90_high': number // 90成本-高
  '90_concentration': number // 90集中度
  '70_low': number // 70成本-低
  '70_high': number // 70成本-高
  '70_concentration': number // 70集中度
}

export const getDaylyList = () =>
  http.get<BaseResponse<Datum[]>>('/bot_server/stock_dayly_recommand')

export const getHistoryList = () =>
  http.get<BaseResponse<Datum[]>>('/bot_server/strategy_history_list')

export interface DragonItem {
  block: string
  block_rate: number
  input: number
  codeName: string
  price: number
  pnl_rate: number
}
export const getDragonList = () => http.get<BaseResponse<DragonItem[]>>('/bot_server/dragon_list')

export interface VirtualDatum {
  block: string
  block_rate: number
  codeName: string
  pnl_rate: number
}
export const getVirtualList = () =>
  http.get<BaseResponse<VirtualDatum[]>>('/bot_server/virtual_list')

// 获取股票详情
export const getStockDetail = (code: string) =>
  http.get<BaseResponse<StockDetail[]>>('/bot_server/getStockCyq', { params: { code } })
